package com.mtsmda;

import java.net.URL;

import javax.xml.namespace.QName;
import javax.xml.ws.Service;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.mtsmda.daoI.CustomerDAOI;
import com.mtsmda.daoImpl.SpCustomerDAOImpl;
import com.mtsmda.daoImpl.WrapperCustomer;
import com.mtsmda.is.admin.domain.Customer;

public class Test {

	public static void main(String[] args) {
//		try {
//			URL wsdlUrl = new URL("http://localhost:9798/wsr/customer?wsdl");
//			QName qName = new QName("http://daoImpl.mtsmda.com/",
//					"CustomerDAOImplService");
//			Service service = Service.create(wsdlUrl, qName);
//			CustomerDAOI customerDAOI = service.getPort(CustomerDAOI.class);
//
//			WrapperCustomer allCustomers = customerDAOI.getAllCustomers();
//			System.out.println(allCustomers.getCustomers().size());
//			for(Customer customer :allCustomers.getCustomers()){
//				System.out.println(customer);
//			}
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
		
		ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-beans.xml");
		SpCustomerDAOImpl spCustomerDAOImpl = applicationContext.getBean("customer", SpCustomerDAOImpl.class);
		WrapperCustomer allCustomers = spCustomerDAOImpl.getAllCustomers();
		System.out.println(allCustomers.getCustomers().size());
		
		StringBuilder builder = new StringBuilder("web.artem.artemov");
		System.out.println(builder.reverse());
	}

}